package com.why.amallrest.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @program: mall-parent
 * @description: swagger配置类
 * @author: @why
 * @create: 2021-10-24 17:29
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket getDocket() {
        //配置aip的各种信息

        ApiInfo apiInfo = new ApiInfoBuilder().title("《商城》后端接⼝说明")
                .description("此⽂档详细说明了商城项⽬后端接⼝规范....")
                .version("v 2.0.1")
                .contact(new Contact("why", "www.why741.xyz", "1585049082@qq.com"))
                .build();
        //指定生成文档的封面信息
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.why.amall.controller"))
                .build();
    }
}
